package cz.worsik.android.test.rideshare.fragments;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cz.worsik.android.test.rideshare.MainActivity;
import cz.worsik.android.test.rideshare.R;
import cz.worsik.android.test.rideshare.constants.ViewConst;
import cz.worsik.android.test.rideshare.util.KalendarTools;

/**
 * A placeholder fragment containing a simple view.
 */
public class JizdyFragment extends AbstractFragment {

    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private static final String ARG_SECTION_NUMBER = "section_number";
    public static final int sectionNumber = 1;
    public static final String key = "DRIVEWAYS";

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static JizdyFragment newInstance() {
        JizdyFragment fragment = new JizdyFragment();

        fragment.setArguments(getBundle());
        return fragment;
    }

    public JizdyFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);

        // misto pro zavolani jednotlivych aktivit?
        TextView date = (TextView) rootView.findViewById(R.id.date);
        date.setText(KalendarTools.getTextForDateLabel(rootView.getContext(), ViewConst.getDate()));

        //TextView textView = (TextView) rootView.findViewById(R.id.section_label);
        //textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
        return rootView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        ((MainActivity) activity).onFragmentnAttached(this);
    }

    public String getActionBarTitle() {
        return super.getActionBarTitle() + ": " + getString(R.string.title_section_jizdy);
    }
}